package cn.edu.ctbu.studentmanage.core;


import cn.edu.ctbu.studentmanage.exception.REnum;
import cn.edu.ctbu.studentmanage.vo.R;

/**
 * 对R对象进行简化
 */
public class RUtil {

    public static R success(Object object){
        R result = new R();
        result.setCode(10);
        result.setData(object);
        result.setMsg("成功执行");
        return result;
    }
    public static R successteacher(Object object){
        R result = new R();
        result.setCode(1);
        result.setData(object);
        result.setMsg("成功执行");
        return result;
    }

//    public static R success(){
//        return success(null);
//    }
//    public static R successteacher(){
//        return successteacher(null);
//    }

    public static R error(Integer code,String msg){
        R result = new R();
        result.setCode(code);
        result.setData(null);
        result.setMsg(msg);
        return result;
    }

    public static R error(REnum rEnum){
        return error(rEnum.getCode(),rEnum.getMsg());
    }


}
